export default {
  cartListLength(state) {
    return state.cartList.length
  },
  cartLists(state) {
    return state.cartList
  },
  cartListAllPrice(state) {
    if (state.cartList.length) {
      let res = state.cartList.reduce((acc, next) => {
        // console.log('a='+acc);
        if (next.check) {
          return acc + next.price * next.count
        }
      }, 0)
      if (res) {
        return res
      } else {
        return 0
      }
    } else {
      return 0
    }
  }
}
